package com.hzy.nacosconfig.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author hzy
 * @since 2022/2/23 22:38
 */
@RefreshScope //nacos 动态刷新, nacos 作为配置中心, 不需要手动调用 actuator/refresh, 直接在nacos上修改发布之后, 应用就会更新
@RestController
public class ConfigController {

    @Value("${config.info}")
    private String configInfo;

    @GetMapping("/config/info")
    public String getConfigInfo(){
        return configInfo;
    }

}
